//
//  ViewController.m
//  代码布局
//
//  Created by iOS on 16/7/19.
//  Copyright © 2016年 iOS. All rights reserved.
//

#import "ViewController.h"
#import "commodityDisplayViewController.h"
#import "commodityProfileSuffix.h"
@interface ViewController ()
@property(nonatomic,strong)UIView * viewred;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"list";
    self.view.backgroundColor = [UIColor whiteColor];
    // Do any additional setup after loading the view, typically from a nib.
//    UIView * view = [[UIView alloc]init];
//    self.viewred = view;
//    view.backgroundColor = [UIColor redColor];
//    [self.view addSubview:view];
//    [view mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.equalTo(self.view);
//        make.centerX.equalTo(self.view);
//        make.left.equalTo(self.view.left).offset(20);
//        make.right.equalTo(self.view.right).offset(-100);
//        make.height.equalTo(HEIGHT/5.0);
//    }];
//    
//    UIView * VIEW2 = [[UIView alloc]init];
//    VIEW2.backgroundColor = [UIColor blueColor];
//    [self.view addSubview:VIEW2];
//    [VIEW2 makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(self.viewred.bottom).offset(10);
//        make.left.equalTo(self.viewred.left).offset(0);
//        make.width.equalTo(self.viewred.width);
//        make.height.equalTo(self.viewred.height);
//    }];
//    UIImage * iamge = [commodityProfileSuffix imageFromString:@"自营"];
//    UIImageView * imageview = [[UIImageView alloc]initWithFrame:CGRectMake(1, 64, iamge.size.width, iamge.size.height)];
//   // imageview.backgroundColor = [UIColor yellowColor];
//    [self.view addSubview:imageview];
//    imageview.image = iamge;
//    
//    UIImage * imagewater = [commodityProfileSuffix watermarkImage:@"自营"];
//    UIImageView * imageview2 = [[UIImageView alloc]initWithFrame:CGRectMake(1, 200, imagewater.size.width, imagewater.size.height)];
//    [self.view addSubview:imageview2];
//    imageview2.image = imagewater;
//
////    countDown * count = [[ countDown alloc]initWithFrame:CGRectMake(0, 100, 200, 100)];
////    count.someTime = @"1480607248";
////    [self.view addSubview:count];
//    
//    EllipsisView * ell = [[EllipsisView alloc]init];
//    //ell.backgroundColor = [UIColor yellowColor];
//    [self.view addSubview:ell];
//    [ell makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(self.view.top).offset(100);
//        make.left.equalTo(self.view.left).offset(100);
//        make.height.equalTo(40/4.0);
//        make.width.lessThanOrEqualTo(40);
//    }];
    UILabel * label = [[UILabel alloc] initWithFrame:CGRectMake(10,100, 50, 40)];
    
    label.backgroundColor = [UIColor redColor];
    
    label.text =@"当前视图的边界和边界大小的变化";
    
    NSLog(@"the label bounds : %@",NSStringFromCGRect(label.frame));
    
    [label sizeToFit];
    
    NSLog(@"the label bounds(sizeToFit) : %@",NSStringFromCGRect(label.frame));
    
    [self.view addSubview:label];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    commodityDisplayViewController  * commodity = [[commodityDisplayViewController alloc]init];
    [self.navigationController pushViewController:commodity animated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
